from rest_framework import serializers
from goods.models import SPUSpecification, SPU


class SPUSpecificationSerializer(serializers.ModelSerializer):
    '''
    SKUSpecification商品规格表
    '''

    # name = serializers.StringRelatedField(source="spu")

    # goods = serializers.StringRelatedField(read_only=True,source="spu")
    #
    # goods_id = serializers.IntegerField(source="spu_id")
    #
    # name = serializers.IntegerField(label='商品SPU', queryset=SPU.objects.all(),source="spu")

    spu = serializers.StringRelatedField(read_only=True)
    spu_id = serializers.IntegerField()

    class Meta:
        model = SPUSpecification
        fields = '__all__'
